<style>
.view {
   overflow: hidden;
   position: relative;
}
.view .mask {
   width: 236px;
   height: 168px;
   position: absolute;
   overflow: hidden;
   top: 0;
   left: 0;
}
.view img {
   -webkit-transition: all 0.2s linear;
   -moz-transition: all 0.2s linear;
   -o-transition: all 0.2s linear;
   -ms-transition: all 0.2s linear;
   transition: all 0.2s linear;
}
.view h2 {
   position: relative;
   font-size: 14px;
   padding: 0;
   margin: 4px 10px 0;
   line-height: 18px;
   
   -webkit-transform: translateY(-100px);
   -moz-transform: translateY(-100px);
   -o-transform: translateY(-100px);
   -ms-transform: translateY(-100px);
   transform: translateY(-100px);
   -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
   filter: alpha(opacity=0);
   opacity: 0;
   -webkit-transition: all 0.2s ease-in-out;
   -moz-transition: all 0.2s ease-in-out;
   -o-transition: all 0.2s ease-in-out;
   -ms-transition: all 0.2s ease-in-out;
   transition: all 0.2s ease-in-out;
}
.view table {
   font-family: Georgia, serif;
   font-style: italic;
   font-size: 11px;
   position: relative;
   margin: 0 10px 10px;
   line-height: 14px;
   
   -webkit-transform: translateY(100px);
   -moz-transform: translateY(100px);
   -o-transform: translateY(100px);
   -ms-transform: translateY(100px);
   transform: translateY(100px);
   -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
   filter: alpha(opacity=0);
   opacity: 0;
   -webkit-transition: all 0.2s linear;
   -moz-transition: all 0.2s linear;
   -o-transition: all 0.2s linear;
   -ms-transition: all 0.2s linear;
   transition: all 0.2s linear;
}

.view table td {
	width: 100px;
}

.view .mask {
   -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
   filter: alpha(opacity=0);
   opacity: 0;
   background-color: #CDCDCD;
   -webkit-transition: all 0.4s ease-in-out;
   -moz-transition: all 0.4s ease-in-out;
   -o-transition: all 0.4s ease-in-out;
   -ms-transition: all 0.4s ease-in-out;
   transition: all 0.4s ease-in-out;
}
.view:hover img {
   -webkit-transform: scale(1.05,1.05);
   -moz-transform: scale(1.05,1.05);
   -o-transform: scale(1.05,1.05);
   -ms-transform: scale(1.05,1.05);
   transform: scale(1.05,1.05);
}

.view:hover .mask {
   -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
   filter: alpha(opacity=100);
   opacity: 1;
}
.view:hover h2,
.view:hover table {
   -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
   filter: alpha(opacity=100);
   opacity: 1;
   -webkit-transform: translateY(0px);
   -moz-transform: translateY(0px);
   -o-transform: translateY(0px);
   -ms-transform: translateY(0px);
   transform: translateY(0px);
}
.view:hover table {
   -webkit-transition-delay: 0.1s;
   -moz-transition-delay: 0.1s;
   -o-transition-delay: 0.1s;
   -ms-transition-delay: 0.1s;
   transition-delay: 0.1s;
}				
</style>
<link href="<?php echo base_url('theme/css/frontend/catslider.css'); ?>" rel="stylesheet">
<link href="<?php echo base_url('theme/css/frontend/search.css'); ?>" rel="stylesheet">
<link href="<?php echo base_url('theme/third_party/bxslider/jquery.bxslider.css'); ?>" rel="stylesheet">
<script src="<?php echo base_url('theme/js/frontend/modernizr.custom.63321.js'); ?>"></script>
<script src="<?php echo base_url('theme/js/frontend/jquery.catslider.js'); ?>"></script>
<script src="<?php echo base_url('theme/third_party/bxslider/jquery.bxslider.js'); ?>"></script>
<script src="<?php echo base_url('theme/third_party/rating/lib/jquery.raty.min.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('.bxslider').bxSlider({
            auto: true,
            controls: false,
            pause: 2000,
            pager: false
        });
        $('.banner-booth').click(function() {
            $('.banner-content').html('<div class="booth-content"><div class="text">Nội dung Gian hàng đảm bảo</div></div>');
        });
        $('.banner-melit').click(function() {
            $('.banner-content').html('<div class="melit-content"><div class="text">Nội dung Quyền lợi người mua</div></div>');
        });
        $('#mi-slider').catslider();
        $.fn.raty.defaults.path = $('input[name=default_path]').val();
        // Hiển thị ô kết quả rating
        $('.rate-view').each(function() {
            $(this).raty({
                number: 5,
                score: $(this).attr('tag'),
                readOnly: true,
                half     : true,
                size     : 16,
                starHalf : 'small_star-half.png',
                starOff  : 'small_star-off.png',
                starOn   : 'small_star-on.png'
            });
        });
        mainPopup('ad');
    });
    function cancelevent(id) {
        var r = confirm("Bạn có chắc chắn muốn huỷ sự kiện này?");
        if (r == true) {
            window.location = "/event/delete/" + $('input[name=id]').val();
        }
    }

    function join(event_id) {
        $.ajax({
            url: '/event/join/' + event_id,
            type: "POST",
            dataType: 'json',
            success: function(data) {
                if (typeof(data['error']) != "undefined") {
                    $("button[name=join][tag=" + event_id + "]").hide();
                    $("button[name=notjoin][tag=" + event_id + "]").hide();
                    $(".join-message[tag=" + event_id + "]").text(data['message']);
                } else {
                    $("button[name=join][tag=" + event_id + "]").hide();
                    $("button[name=notjoin][tag=" + event_id + "]").hide();
                    $(".join-message[tag=" + event_id + "]").text("Đăng ký tham gia thành công.");
                }
            }
        });
    }

    function notjoin(event_id) {
        $.ajax({
            url: '/event/notjoin/' + event_id,
            type: "POST",
            dataType: 'json',
            success: function(data) {
                if (typeof(data['error']) != "undefined") {
                    $("button[name=join][tag=" + event_id + "]").hide();
                    $("button[name=notjoin][tag=" + event_id + "]").hide();
                    $(".join-message[tag=" + event_id + "]").text(data['message']);
                } else {
                    $("button[name=join][tag=" + event_id + "]").hide();
                    $("button[name=notjoin][tag=" + event_id + "]").hide();
                    $(".join-message[tag=" + event_id + "]").text("Từ chối tham gia thành công.");
                }
            }
        });
    }

    function change(id, type) {
        if (type == 1) {
            window.location = "/event/company/" + id;
        } else if (type == 2) {
            window.location = "/event/booth/" + id;
        }
    }
    
    function checkPost() {
        var user_id = $('input[name=user_id]').val();
        if (user_id == 0) {
            alert("Bạn cần phải đăng nhập để đăng tin!")
        } else {
            window.location = '/user/changingAccountInformation';
        }
    }
</script>
<?php if (!isset($extra)): ?>
<div id="banner-left">
    <input type="hidden" name="user_id" value="<?php if (isset($_SESSION['userLoggedIn']['id']) && $_SESSION['userLoggedIn']['id'] != "") { echo $_SESSION['userLoggedIn']['id']; } else { echo 0; }?>" />
    <input type="hidden" name="default_path" value="<?php echo base_url('theme/third_party/rating/lib/img/'); ?>" />
    <div id="slideshow" class="uh_blue_style_with_gradient" style="width:700px;height:430px;">
        <div class="bgback"></div>
        <div class="iosSlider zn_slideshow hideControls" style="position: relative; top: 0px; left: 0px; overflow: hidden; z-index: 1; -webkit-perspective: 1000px; -webkit-backface-visibility: hidden; width: 700px; height: 430px !important; background-image: none;">
            <div class="slider" style="position: relative; cursor: -webkit-grab; -webkit-perspective: 0; -webkit-backface-visibility: hidden; width: 3972px; -webkit-transform: matrix(1, 0, 0, 1, -6951, 0);">
                <?php for($i = 0; $i < 6; $i++) { ?>
                    <?php if($i == 0 || $i == 3) { ?>
                        <div class="item" style="width: 700px; -webkit-backface-visibility: hidden; position: absolute; top: 0px; -webkit-transform: matrix(1, 0, 0, 1, 7944, 0);">
                            <a <?php if(isset($banner[$i]) && $banner[$i]['url'] != "") { ?>href="<?php echo $banner[$i]['url']; ?>"<?php } ?>>
                                <?php if(isset($banner[$i]) && $banner[$i]['image'] != "") { ?>
                                    <img src="<?php echo base_url('/upload/general/') . '/' . $banner[$i]['image']; ?>" alt="Ad">
                                <?php } else { ?>
                                    <img src="<?php echo base_url('theme/images/700x430.jpg'); ?>" alt="Ad">
                                <?php } ?>
                                <div class="caption style1 zn_def_anim_pos">
                                    <?php if(isset($banner[$i]) && $banner[$i]['title1'] != "") { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-left: 0px;"><?php echo $banner[$i]['title1']; ?></h2>
                                    <?php } else { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-left: 0px;">AUTUMN 2012<br>COLLECTION</h2>
                                    <?php } ?>    
                                    <?php if(isset($banner[$i]) && $banner[$i]['title2'] != "") { ?>
                                        <h3 class="title_big" style="left: 0px; opacity: 1;"><?php echo $banner[$i]['title2']; ?></h3>
                                        <a class="more" href="#" target="_self" style="left: 0px; opacity: 1;">
                                            <img style="height:auto!important" width="10" height="16" src="http://hogash-demo.com/kallyas_wp/wp-content/themes/kallyas/sliders/iosslider/arr01.png" alt="">
                                        </a>
                                    <?php } else { ?>
                                        <h3 class="title_big" style="left: 0px; opacity: 1;">20% DISCOUNT</h3>
                                        <a class="more" href="#" target="_self" style="left: 0px; opacity: 1;">
                                            <img style="height:auto!important" width="10" height="16" src="http://hogash-demo.com/kallyas_wp/wp-content/themes/kallyas/sliders/iosslider/arr01.png" alt="">
                                        </a>
                                    <?php } ?>
                                    <?php if(isset($banner[$i]) && $banner[$i]['title3'] != "") { ?>
                                        <h4 class="title_small" style="left: 0px; opacity: 1;"><?php echo $banner[$i]['title3']; ?></h4>
                                    <?php } else { ?>
                                        <h4 class="title_small" style="left: 0px; opacity: 1;">FOR THE PRODUCTS IN OUR NEWEST COLLECTION</h4>
                                    <?php } ?>                  
                                </div>
                            </a>
                        </div><!-- end item -->
                    <?php } else if($i == 1 || $i == 4) { ?>
                         <div class="item" style="width: 700px; -webkit-backface-visibility: hidden; position: absolute; top: 0px; -webkit-transform: matrix(1, 0, 0, 1, 7944, 0);">
                            <a <?php if(isset($banner[$i]) && $banner[$i]['url'] != "") { ?>href="<?php echo $banner[$i]['url']; ?>"<?php } ?>>
                                <?php if(isset($banner[$i]) && $banner[$i]['image'] != "") { ?>
                                    <img src="<?php echo base_url('/upload/general/') . '/' . $banner[$i]['image']; ?>" alt="Ad">
                                <?php } else { ?>
                                    <img src="<?php echo base_url('theme/images/700x430.jpg'); ?>" alt="Ad">
                                <?php } ?>
                                <div class="caption style2 fromright" style="left:113%;">
                                    <?php if(isset($banner[$i]) && $banner[$i]['title1'] != "") { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-right: 0px;"><?php echo $banner[$i]['title1']; ?></h2>
                                    <?php } else { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-right: 0px;">YOUR LIVING<br>DESERVES BETTER</h2>
                                    <?php } ?>
                                    <?php if(isset($banner[$i]) && $banner[$i]['title2'] != "") { ?>
                                        <h3 class="title_big" style="right: 0px; opacity: 1;"><?php echo $banner[$i]['title2']; ?></h3>
                                        <a class="more" href="#" target="_self" style="right: 0px; opacity: 1;">
                                            <img style="height:auto!important" width="10" height="16" src="http://hogash-demo.com/kallyas_wp/wp-content/themes/kallyas/sliders/iosslider/arr01.png" alt="">
                                        </a>
                                    <?php } else { ?>
                                        <h3 class="title_big" style="right: 0px; opacity: 1;">IT'S YOUR COUCH</h3>
                                        <a class="more" href="#" target="_self" style="right: 0px; opacity: 1;">
                                            <img style="height:auto!important" width="10" height="16" src="http://hogash-demo.com/kallyas_wp/wp-content/themes/kallyas/sliders/iosslider/arr01.png" alt="">
                                        </a>
                                    <?php } ?>
                                    <?php if(isset($banner[$i]) && $banner[$i]['title3'] != "") { ?>
                                        <h4 class="title_small" style="right: 0px; opacity: 1;"><?php echo $banner[$i]['title3']; ?></h4>
                                    <?php } else { ?>
                                        <h4 class="title_small" style="right: 0px; opacity: 1;">CHOOSE WHAT YOU LIKE, COMBINE IT HOW YOU WANT</h4>
                                    <?php } ?>
                                </div>
                            </a>
                        </div><!-- end item -->
                    <?php } else { ?>
                        <div class="item" style="width: 700px; -webkit-backface-visibility: hidden; position: absolute; top: 0px; -webkit-transform: matrix(1, 0, 0, 1, 7944, 0);">
                            <a <?php if(isset($banner[$i]) && $banner[$i]['url'] != "") { ?>href="<?php echo $banner[$i]['url']; ?>"<?php } ?>>
                                <?php if(isset($banner[$i]) && $banner[$i]['image'] != "") { ?>
                                    <img src="<?php echo base_url('/upload/general/') . '/' . $banner[$i]['image']; ?>" alt="Ad">
                                <?php } else { ?>
                                    <img src="<?php echo base_url('theme/images/700x430.jpg'); ?>" alt="Ad">
                                <?php } ?>
                                <div class="caption style3 fromright" style="margin-left:-450px!important;">
                                    <?php if(isset($banner[$i]) && $banner[$i]['title1'] != "") { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-right: 0px;"><?php echo $banner[$i]['title1']; ?></h2>
                                    <?php } else { ?>
                                        <h2 class="main_title" style="opacity: 1; margin-right: 0px;">AUTUMN 2012<br>COLLECTION</h2>
                                    <?php } ?>
                                    <?php if(isset($banner[$i]) && $banner[$i]['title2'] != "") { ?>
                                        <h3 class="title_big" style="right: 0px; opacity: 1;">
                                            <span class="stronger"><?php echo $banner[$i]['title2']; ?></span>
                                        </h3>
                                    <?php } else { ?>
                                        <h3 class="title_big" style="right: 0px; opacity: 1;">
                                            <span class="stronger">20%</span> DISCOUNT
                                        </h3>
                                    <?php } ?>
                                    <?php if(isset($banner[$i]) && $banner[$i]['title3'] != "") { ?>
                                        <h4 class="title_small" style="right: 0px; opacity: 1;"><?php echo $banner[$i]['title3']; ?></h4>
                                    <?php } else { ?>
                                        <h4 class="title_small" style="right: 0px; opacity: 1;">FOR THE PRODUCTS IN OUR NEWEST COLLECTION</h4>
                                    <?php } ?>  
                                </div>
                            </a>
                        </div><!-- end item -->
                    <?php } ?>
                <?php } ?>
            </div>
            <div class="prev" style="cursor: pointer;">
                <div class="btn-label">PREV</div>    
            </div>
            <div class="next" style="cursor: pointer;">
                <div class="btn-label">NEXT</div>   
            </div>  
        </div><!-- end iosSlider -->									
        <div class="selectorsBlock bullets">
            <div class="selectors">
                <div class="item first" style="cursor: pointer;"></div>
                <div class="item" style="cursor: pointer;"></div>
                <div class="item" style="cursor: pointer;"></div>
                <div class="item" style="cursor: pointer;"></div>
                <div class="item" style="cursor: pointer;"></div>
                <div class="item selected" style="cursor: pointer;"></div>	
            </div>
        </div>
        <div class="scrollbarContainer"></div>
        <div class="zn_header_bottom_style"></div><!-- header bottom style -->
    </div>
</div>
<div id="banner-right">
    <div class="left banner-booth orange">
        Gian hàng<br/>đảm bảo
    </div>
    <div class="space"></div>
    <div class="right banner-melit orange">
        Quyền lợi<br/>người mua
    </div>
    <div class="content banner-content">
        <div class="booth-content">
            <div class="text">
                Nội dung Gian hàng đảm bảo
            </div>
        </div>
    </div>
    <div class="banner-post">
        <button class="btn btn-event banner-post-button btn-primary" type="button" onclick="checkPost()">
            Đăng tin
        </button>
    </div>
</div>
<div id="banner-ad">
    <ul class="bxslider">
        <?php for($j = 6; $j < 9; $j++) { ?>
            <?php if(isset($banner[$j]) && $banner[$j]['image'] != "") { ?>
                <li><img src="<?php echo base_url('/upload/general/') . '/' . $banner[$j]['image']; ?>"/></li>
            <?php } else { ?>
                <li><img src="<?php echo base_url('theme/images/700x430.jpg'); ?>" alt="Ad"></li>
            <?php } ?>
        <?php } ?>
    </ul>
</div>
<div id="product-slider">
    <div id="mi-slider" class="mi-slider">
        <?php for ($i = 0; $i < 3; $i++) { ?>
            <ul>
                <?php foreach ($products as $product) { ?>
                    <li style="padding:6px!important;width:139px!important">
                        <a rel="mainPopup[ajax]" href="<?php echo base_url("gian-hang/{$product['booth_slug']}/{$product['slug']}"); ?>" data-url="">
                            <img style="width: 100px;height: 100px;" src="<?php echo base_url("upload/booth/{$product['user_id']}/avatar/{$product['avatar']}"); ?>" alt="">
                        </a>
                        <div class="caption orange">
                            <div class="product-name">
                                <?php if($product['name'] != "") { 
                                        echo characterLimiter($product['name'],15); 
                                      } else {
                                        echo "Title mặc định";
                                      }
                                ?>
                            </div>
                            <div class="product-price"><?php echo $product['price'] ?> VNĐ</div>
                        </div>
                    </li>
                <?php } ?>
            </ul>
        <?php } ?>
        <nav style="top: 128px; max-width: 900px !important;">
            <a href="#" class="mi" style="font-weight:bold;width: 150px;">Bán chạy nhất</a>
            <a href="#" class="mi" style="font-weight:bold;width: 150px;">Sản phẩm giảm giá</a>
            <a href="#" class="mi" style="font-weight:bold;width: 150px;">Sản phẩm mua nhiều</a>
        </nav>
    </div>
</div>
<?php endif; ?>
<ul class="thumbnails items">
    <?php
    $i = 0;
    foreach ($results as $result):
        ?>
        <?php if ($i == 0 || $i == 11): ?>
            <li class="position-promotion" style="width: 463px; height: 435px;<?php if($i == 11):?>float:right;margin-right:2px;<?php endif; ?>">
                <?php if ($result['type'] == 'booth') { ?>
                    <a style="display:block; height:366px; position:relative;" href="/gian-hang/<?php echo $result['slug']; ?>" ">
                        <img style="position:absolute;top:0;left:0;bottom:0;right:0;margin:auto;width: 460px; height: 366px;" src="<?php echo base_url("upload/booth/{$result['user_id']}/avatar/{$result['avatar']}"); ?>">
                    </a>
                    <div class="caption">
                        <div style="margin-top: 6px; border:1px dashed #C6C6C6"></div>     
                        <h6><?php echo characterLimiter($result['name'], 64); ?></h6>
                        <div><?php echo getBoothCategories($result['category_id']); ?></div>
                        <div class="caption-left" style="margin-top:20px;">
                            <div class="rate-view" tag="<?php echo $result['rate']; ?>"></div>
                        </div>
                        <div class="caption-right" style="margin-top:18px!important;">
                            <div class="comment">
                                <?php echo $result['count_comment']; ?>
                            </div>
                            <div class="detail" onclick="loadDetail('');">
                            </div>
                        </div>
                    </div>
                <?php } else { ?>
                    <a style="display:block; height:366px; position:relative;" rel="mainPopup[ajax]" href="<?php echo base_url('rao-vat/true/' . $result['ad_id']); ?>" data-url="" >
                        <img style="position:absolute;top:0;left:0;bottom:0;right:0;margin:auto;width: 460px; height: 366px;" src="<?php echo base_url('upload/ad/avatar/' . $result['user_id'] . '/' . $result['avatar']); ?>">
                    </a>
                    <div class="caption">
                        <div style="margin-top: 6px; border:1px dashed #C6C6C6"></div>
                        <h6><?php echo characterLimiter($result['title'], 64); ?></h6>
                        <div><?php echo getAdCategories($result['category_id']); ?></div> 
                        <div class="caption-left" style="margin-top:20px;">
                            <div class="rate-view" tag="<?php echo $result['rate']; ?>"></div>
                        </div>
                        <div class="caption-right" style="margin-top:18px!important;">
                            <div class="comment">
                                <?php echo $result['count_comment']; ?>
                            </div>
                            <div class="detail" onclick="loadDetail('');">
                            </div>
                        </div>
                    </div>
                <?php } ?>
            </li>
        <?php else: ?>
            <li style="height:210px !important;">
                <?php if ($result['type'] == 'booth') { ?>
                  <?php $url = base_url("upload/booth/{$result['user_id']}/avatar/{$result['avatar']}"); ?>
                  <?php $href = '/gian-hang/' . $result['slug']; ?>
                <?php } else { ?>
                  <?php $url = base_url('upload/ad/avatar/' . $result['user_id'] . '/' . $result['avatar']); ?>
                  <?php $href = base_url('rao-vat/true/' . $result['ad_id']); ?>
                  <?php $data_url = base_url('rao-vat/' . $result['slug']); ?>
                <?php } ?>
                <div class="view">
                  <div style="display:block; height:155px; position:relative;">
                    <img style="position:absolute;top:0;left:0;bottom:0;right:0;margin:auto;width: 460px; height: 155px;" src="<?php echo $url; ?>">
                  </div>
                  <div class="mask">
                    <h2><?php 
                    if ($result['type'] == 'booth') {
                      echo $result['name'];  
                    } else {
                      echo $result['title']; 
                    }
                    ?></h2>
                    <table>
                      <?php if(@isset($result['warranty'])): ?>
                      <tr>
                        <td>Bảo hành:</td> 		
                        <td><?php echo @$result['warranty']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['status'])): ?>
                      <tr>
                        <td>Tình trạng:</td> 	
                        <td><?php echo @$result['status']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['forms'])): ?>
                      <tr>
                        <td>Hình thức:</td>	
                        <td><?php echo @$result['forms']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['made_in'])): ?>
                      <tr>
                        <td>Xuất sứ:</td>	
                        <td><?php echo @$result['made_in']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['shipping'])): ?>
                      <tr>
                        <td>Vận chuyển:</td>	
                        <td><?php echo @$result['shipping']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['quatity'])): ?>
                      <tr>
                        <td>Số lượng hàng</td>	
                        <td><?php echo @$result['quatity']; ?></td>
                      </tr>
                      <?php endif; ?>
                      <?php if(@isset($result['district'])): ?>
                      <tr>
                        <td>Nới đăng:</td>
                        <td><?php echo @$result['district']; ?></td>
                      </tr>
                      <?php endif; ?>
                    </table>
                  </div>
                </div>
                <div class="caption">
                    <div style="margin-top: 6px; border:1px dashed #C6C6C6"></div>
                    <h6>
                      <a style="display:block; position:relative;" href="<?php echo $href; ?>" data-url="<?php echo $data_url; ?>" <?php if ($result['type'] != 'booth'):  ?>rel="mainPopup[ajax]"<?php endif; ?> >
                        <?php echo ($result['type'] == 'booth') ? characterLimiter($result['name'], 30) : characterLimiter($result['title'], 30); ?>
                      </a>
                    </h6>
                    <div><?php echo getBoothCategories($result['category_id']); ?></div> 
                    <div class="caption-left" style="margin-top:6px">
                        <div class="rate-view" tag="<?php echo $result['rate']; ?>"></div>
                    </div>
                    <div class="caption-right" style="margin-top:6px!important;">
                        <div class="comment">
                            <?php echo $result['count_comment']; ?>
                        </div>
                        <div class="detail" onclick="loadDetail('');">
                        </div>
                    </div>
                </div>         
            </li>
        <?php endif; ?>
        <?php
        $i++;
    endforeach;
    ?>
</ul>

<?php if (!isset($extra)): ?>
<script type="text/javascript">
    $(document).ready(function() {
        window.onload = function () { 
            mainPopup('ad');
        };
    });
</script>

<script type="text/javascript">
    $(document).ready(function() {
    	mainPopup('ad');
        var page = 0;
        window.onscroll = function() {
            scrollY = window.pageYOffset;
            scrollMaxY = document.documentElement.scrollHeight - document.documentElement.clientHeight;
            if (scrollY == scrollMaxY) {
            	page++; //s tăng lên một mỗi lần cuộn
                var url = '<?php echo base_url('main/index'); ?>';
                var url = url + '\/' + page + '/NULL';

                $.get(url, function(data) {
                    $('.items').append(data); // append to <ul>
                    mainPopup('ad');
                });
            }
        }; // end onscroll

    });
</script>
<?php endif; ?>